package com.sam.widget.headerBar;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;

import com.sam.widget.FontTextView;
import com.sam.widget.R;
import button.StateImageButton;


public class LeftImgTitleRightImgBar extends LeftImgTitleBar {
    private Drawable rightImgSrc,rightImgBg;
    private StateImageButton rightImgBtn;
    public LeftImgTitleRightImgBar(Context context) {
        super(context);
    }

    public LeftImgTitleRightImgBar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public LeftImgTitleRightImgBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void getAttrs(AttributeSet attrs) {
        super.getAttrs(attrs);
        TypedArray ta = context.obtainStyledAttributes(attrs,R.styleable.LeftImgTitleRightImgBar);
        rightImgSrc=ta.getDrawable(R.styleable.LeftImgTitleRightImgBar_rightImgsrc);
        rightImgBg=ta.getDrawable(R.styleable.LeftImgTitleRightImgBar_rightImgbg);
        ta.recycle();
    }

    @Override
    protected void findView() {
        super.findView();
        rightImgBtn = new StateImageButton(context);
    }

    @Override
    protected void initView() {
        super.initView();
        if (rightImgSrc!=null) rightImgBtn.setImageDrawable(rightImgSrc);
        if (rightImgBg!=null)   rightImgBtn.setBackgroundDrawable(rightImgBg);
    }


    @Override
    public View getRightView() {
        return rightImgBtn;
    }
}
